package com.kimehwa.studyboot.basejava.reflact;

import java.lang.reflect.InvocationTargetException;

public class Person {
    private String name;
    private int age;

    Person() {
    }

    Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public void run() {
        System.out.println("马儿正在奔跑");
    }

    public static void main(String[] args) throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, ClassNotFoundException {
        Class<Person> personClass = Person.class;
//        Person person = personClass.newInstance();
        Class<?> aClass = Class.forName("com.kimehwa.studyboot.basejava.reflact.Person");
        System.out.println(personClass == aClass);
        Person person = personClass.getDeclaredConstructor().newInstance();
        person.run();
    }
}
